package com.Servlet;

import com.Bean.Ticket;
import com.Util.TkDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = "/closeticket")
public class closeticket extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String tkid=req.getParameter("tkid");
        String username=req.getParameter("username");
        Ticket tk = TkDao.selectTkbyId(req.getParameter("tkid"));
        tk.setStatus("closed");
        TkDao.updateTk(tk);
        resp.sendRedirect("./serve/message.jsp?tkid="+tkid+"&u="+username);

    }
}
